﻿// HSS.Extensions.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       Extensions.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS
{
	#region Extensions
	/// <summary>
	/// HSS Extension Methods
	/// </summary>
	public static class Extensions
	{
		#region IConfigurationElement
		/// <summary>
		/// Serializes the current instance using a BinaryFormatter and encrypts the resulting binary data using the provided password.
		/// </summary>
		/// <param name="instance">The IConfigurationElement instance</param>
		/// <param name="password">The password to encrypt this instance.</param>
		/// <returns>A BASE64 string.</returns>
		public static string ToEncryptedString(this IConfigurationElement instance, string password)
		{
			return ObjectSerialization.ToEncryptedString(instance, password);
		}
		/// <summary>
		/// Serializes an IConfigurationElement instance to an Array of Bytes
		/// </summary>
		/// <param name="value">The IConfigurationElement instance</param>
		/// <returns>The Binary version of the instance as an Array of Bytes</returns>
		public static byte[] ToByteArray(this IConfigurationElement value)
		{
			return ObjectSerialization.ToByteArray(value);
		}
		#endregion
	}
	#endregion
}